package com.book.service.impl;

import com.book.model.TBook;
import com.book.mapper.TBookDao;
import com.book.service.TBookService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wx
 * @since 2023-10-13 18:04:30
 */
@Service
public class TBookServiceImpl extends ServiceImpl<TBookDao, TBook> implements TBookService {
    @Autowired
    private TBookDao tBookDao;
    @Override
    public List<TBook> getAllBook() {
        List<TBook> tBooks = tBookDao.selectList(null);
        return tBooks;
    }

    @Override
    public void addBook(TBook tBook) {
        tBookDao.insert(tBook);
    }

    @Override
    public void updateBook(TBook tBook) {
        tBookDao.updateById(tBook);
    }

    @Override
    public void deleteBook(Long id) {
        tBookDao.deleteById(id);
    }
}
